package com.ulic.customerManApplication.usermodule.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.ulic.customerManApplication.pager.PagerModel;
import com.ulic.customerManApplication.usermodule.bo.User;
import com.ulic.customerManApplication.usermodule.dao.UserDao;
import com.ulic.customerManApplication.usermodule.service.UserService;
import com.ulic.customerManApplication.util.md5.MD5;
@Component("userServices")
public class UserServiceImpl implements UserService {
	private UserDao userDao;
	
	public PagerModel getPager(int page) throws Exception{
		return userDao.getPager(page);
	}
	public User findUserByPwd(String username, String password)
			throws Exception {
		password = MD5.getMD5Digest(password);
		return userDao.findUserByPwd(username, password);
	}
	
	@Resource
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
	/**
	 * Description: 根据id查询用户
	 * @Version1.0 
	 * 2012-7-11 下午04:59:42 李求智 (liqz@huilan.com) created
	 * @param userid
	 * @return
	 * @throws Exception
	 */
	@Override
	public User findUserByUserId(String userid) throws Exception {
		return userDao.findUserByUserId(userid);
	}
	/**
	 * Description: 修改用户
	 * @Version1.0 
	 * 2012-7-11 下午05:09:22 李求智 (liqz@huilan.com) created
	 * @param user
	 * @throws Exception
	 */
	@Override
	public void updateUser(User user) throws Exception {
		userDao.updateUser(user);
	}
	/**
	 * Description: 
	 * @Version1.0 
	 * 2012-7-16 上午10:30:57 李求智 (liqz@huilan.com) created
	 * @param curPage
	 * @param user
	 * @param roletype
	 * @param activietype
	 * @param startDate
	 * @param endDate
	 * @return
	 * @throws Exception
	 */
	@Override
	public PagerModel getPager(int curPage, User user, String roletype,
			String activietype, String startDate, String endDate,String organOid)
			throws Exception {
		return userDao.getPager(curPage, user, roletype, activietype, startDate, endDate,organOid);
	}
	/**
	 * Description: 获得用户角色名
	 * @Version1.0 
	 * 2012-7-17 上午09:33:40 李求智 (liqz@huilan.com) created
	 * @param userid
	 * @return
	 * @throws Exception
	 */
	@Override
	public String getUserRoleName(String userid) throws Exception {
		return userDao.getUserRoleName(userid);
	}
	@Override
	public String getUserRName(String userid) throws Exception {
		return userDao.getUserRName(userid);
	}
	
	public static void main(String[] args){
		System.out.println(MD5.getMD5Digest("1"));
	}
	

}
